import React, { Component } from 'react'
import {connect} from 'react-redux'
import { add } from '../store/actions/count'

class Count extends Component {
  render() {
    return (
      <div>
        <h2>{this.props.count}</h2>
        <button onClick={this.props.add}>add</button>
      </div>
    )
  }
}

function mapStateToProps(state) {
  return {
    count: state.count.count
  }
}

let mapDispatchToProps = {
  add
}

export default connect(mapStateToProps, mapDispatchToProps)(Count)